var mailConfig = function(){
    return{
        mailEdit: function () {
            $.post('/system/mailDetail', function (result) {
                console.info(result["rows"][0]["From"])
                if (result != null) {
                    $("#host1").val(result["rows"][0]["Host"]);
                    $("#username1").val(result["rows"][0]["Username"]);
                    $("#pwd1").val(result["rows"][0]["Pwd"]);
                    $("#from1").val(result["rows"][0]["From"]);
                }
            }, 'json');
            $('#w').window('open');
        },

        //关闭弹出框
        closePopu: function () {
            $('#w').window('close');
        },


        //保存修改完操作
        save: function () {
            var Host= $("#host1").val();
            var Username= $("#username1").val();
            var Pwd= $("#pwd1").val();
            var From= $("#from1").val();
            var parmas={Host:Host,Username:Username,Pwd:Pwd,From:From}
            $.ajax({
                type: 'POST',
                url: '/system/mailEdit',
                dataType: 'json',
                data: parmas,
                success: function (result) {
                    if (result['info'] == 'Success') {
                        alert("修改邮箱配置成功！")
                        mailConfig.closePopu();
                        window.location.reload();
                    } else {
                        alert("修改邮箱配置失败！")
                    }
                }
            })

        },

    }

}
();
